<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php session_start();
	include_once 'backend/select_project.php';
	include_once 'backend/breadcrumb.php';
?>
<html xmlns = "http://www.w3.org/1999/xhtml">
	<head>
		<title>
			Projects
		</title>
		
		<script type="text/javascript" src="scripts/jquery-1.11.1.min.js"></script>		
		<script type="text/javascript" src="scripts/url-parameter.js"></script>
		<script type="text/javascript" src="scripts/projects.js"></script>
		<link rel="stylesheet" type="text/css" href="css/main.css" />		
	</head>
	
	<body>	
		<p id="projectHeader" class="header">Project</p>
		<div id="breadcrumb"><?php echo projectBreadCrumb($project['project_id']);?></div>
		<div id="projectDetails" class="detailsHeader" style="display:table; margin-left:auto; margin-right:auto;">
			<div class="detailsHeaderLeft">
				<label>Project Name:</label><?php echo "<input id='projectName' type='text' value='$project[project_name]'/>"?>
			</div>
			<div class="detailsHeaderRight">
				<label>Iteration Length (Days):</label><?php echo "<input id='iterationLength' type='text' value='$project[iteration_length]'/>"?>
			</div>
			<div class="detailsHeaderLeft">
				<label>Start Date:</label><?php echo "<input id='startDate' type='date' onchange='calcEndDate()' value='$project[start_date]'/>"?>
			</div>
			<div class="detailsHeaderRight">
				<label>End Date:</label><?php echo "<input id='endDate' type='date' value='$project[end_date]' disabled/>"?>
			</div>
			<div style="margin-top:120px; text-align: center;">
				<input type="button" value="Save" onclick="saveProject()"/>
				<input type="button" id="deleteButton" value="Delete" onclick="deleteProject()"/>
			</div>
		</div>
		<div class="left">
			<p class="subheader">
				Iterations
			</p>
			<p>
				<?php 
					$arrIterations = getListOfIterationsForProject();
					foreach($arrIterations as $iteration){
						echo "<p><a href=\"iterations.php?id=$iteration[iteration_id]\">$iteration[iteration_id]</a></p>";
					}
				?>
			</p>
			<input type="button" value="New Iteration" onclick="createIteration()"/>
		</div>
		
		<div class="right">
			<p class="subheader">
				User Stories
			</p>
			<p>
				<?php 
		 
					$arrStories = getListOfStoriesForProject();
					foreach($arrStories as $story){
						echo "<p><a href=\"story.php?id=$story[story_id]&taskUrl=0\">$story[story_name]</a></p>";
					}
					
				?>
			</p>
		</div>
	</body>
</html>